package com.whpost.service.dao.stamp;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.whpost.service.entity.stamp.StampCardOrderMx;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StampCardOrderMxMapper extends BaseMapper<StampCardOrderMx> {


    @Select("select * from stamp_card_order_mx where id=#{0}")
    @Results(id="cardOrderMxMap",value = {
            @Result(column="stamp_card_order_id",property="stampCardOrder",
                    one=@One(
                            select="com.whpost.service.dao.stamp.StampCardOrderMapper.getById")
            ),
            @Result(column="stamp_card_order_id",property="stampCardOrderId"),
            @Result(column="t_hyxx_id",property="tHyxx",
                    one=@One(
                            select="com.whpost.service.dao.t.THyxxDao.getHyxxContainNickname")
            ),
            @Result(column="t_hyxx_id",property="tHyxxId"),
            @Result(column="stamp_card_id",property="stampCard",
                    one=@One(
                            select="com.whpost.service.dao.stamp.StampCardMapper.getById")
            ),
            @Result(column="stamp_card_id",property="stampCardId"),
            @Result(column="id",property="id")
    })
    StampCardOrderMx getById(Long id);


    @Select("select * from stamp_card_order_mx where ${ew.sqlSegment}")
    @ResultMap(value="cardOrderMxMap")
    IPage<StampCardOrderMx> getStampCardOrderMxLPage(Page<StampCardOrderMx> page, @Param("ew") QueryWrapper wrapper);

    @Select("select * from stamp_card_order_mx where ${ew.sqlSegment}")
    @ResultMap(value="cardOrderMxMap")
    List<StampCardOrderMx> getStampCardOrderMxList(@Param("ew") QueryWrapper wrapper);


}